<?php
	include "../config.php";
	$sql = mysql_query("SELECT hotels.id, hotels.hotel_name FROM hotels");
	
	while($ht = mysql_fetch_array($sql)){
		$string = strtolower($ht['hotel_name']);
		$id = $ht['id'];
		
		$slug = preg_replace('/[^A-Za-z0-9-]+/', '_', $string);
		$slug = str_replace(array("-"),array(""),$slug);
		$slug = str_replace(array("__"),array("_"),$slug);
		
		$sql2 = mysql_query("UPDATE hotels SET hotel_slug='$slug' WHERE id='$id'");
	}
?>